<?php
class GuestbookController extends Zend_Controller_Action
{
	 //	setup Index
    public function init()
    {
        /* Initialize action controller here */
        //$this->_helper->viewRenderer->setNoRender();      //ko dung View
        $this->_helper->layout->disableLayout();            //ko load Layout vào ứng dụng
    }
	
	//Lay ra tat ca cac object trong table Guestbook
	public function indexAction()
	{
 		$guestbook = new Application_Model_GuestbookMapper();
        $this->view->entries = $guestbook->fetchAll();
	}

	//Lay ra 1 object trong table Guestbook
	public function showAction()
	{
		$id = "1";			//truyen 1 parameter id sang		
		$guestbook = new Application_Model_GuestbookMapper();
		$this->view->entry = $guestbook->fetchRow($id);		
	}
		
	//Them moi 1 record vao table Guestbook
	public function saveAction()
	{
		/*
		$form = IndexForm::registerForm();

		//handle if form is invalid
		if (!$form->isValid($_POST)) 
		{
			$this->view->form = $form;
			$this->render("register");
			return;
		}
		
		//get form values
		$v = $form->getValues();
		
		//include model
		require_once ‘models/User.php’;
		$user = new User();
		
		$data = array(
			"email" => $v['email'],
			"email" => $v['email'],
			"password" => $v['password'],
			"gender" => $v['gender']
			);
		$user->insert($data);
		$this->render();
		*/
	}
	
	//Sua 1 record trong table Guestbook
	public function updateAction()
	{
		
	}
	
	//Xoa 1 record trong table Guestbook
	public function deleteAction()
	{
		
	}	
	//more function....
}